apiready = function() {
seajs.use(['../../V',"../../api","../../jquery","../../app","../../service","../../swiper","../../dialog"],function(V,$api,$,app,service,Swiper,dialog){
	app.ready();
	var vm = {
			el: '.vue-content',
	  	data: {
				tagList: '',	//标签的数组
				classfiyList: '',	//分类的数组
				bigger: false,	//控制前端轮播图的css
				small: false,

				isRecommend: false,	//热门推荐 boolean值
				isGroup: false,	//极速拼团 boolean值
				templateList: ['1'],	//初始化商品型号模版数组
				detailData:[],

				tag_name: '',	//标签名称显示
				tag: '',	//标签ID（上传到接口的数据）
				yzcTag: false,	// 1	发布YZC商品 0 不发布YZC商品
				sys_cat_name: '',	//系统类目名称显示
				cat_id: '',	//系统类目id
				category_id: '',	//新建分类返回的id
				cat_name: '',	//分类名称显示
				imgarr:'',	//上传图片返回的地址字符串（接口用）
				num: '',	//已上传图片数量
				swiperImageArr: [],	//轮播图的图片数组
				mySwiper: '',	//swiper对象
				titleContent: '',
				kill_start_time: '',
				kill_end_time: '',
				goodsSpec: [],	//商品型号
				imgSpec: [],	//商品型号对应的图片
				killPrice: [],	//秒杀价格
				goodsPrice: [],
				marketPrice: [''],
				yzcPrice: [],
				goodsNum: [],
				goodsCode: [],
				description: '',
				groupNum: [],	//拼团人数
				groupNumIndex: '',
				picked: '',	//--拼团人数选择器
				reason_tag: ['请选择'],
				groupPrice: [],
				firstBrokerage: '',
				secondBrokerage: '',
				brokerageMark: true,
				dispatch_type: 0,	//运费模式
				dispatch_fee: '',	//固定运费
				dispatch_id: '',	//运费模版id
				weight: '',	//商品重量
				dispatch_name: '请选择运费模版',
				dispatchList: '',
				genuine: 1,
				speed_return: 0,	//--极速退款 暂时不做。
				seven_reason: 1,

				edit: '',
				goodsList: [],
				textNum: 0,
				on_sale: 1,
				goods_id: ''
	  	},
			created: function () {
				var that = this;
				var shopId = api.pageParam.shopId; // 商店id
				var unionid = $api.getStorage("shop_unionid"); // 用户id

				// //--获取标签列表
				// this.getTag();
				//--获取分类列表
				this.getCat();
				//--获取运费模版列表
				this.getDispatchList();

				//--编辑商品
				this.edit = api.pageParam.edit;
				if(this.edit == 1){
					var goodsId = api.pageParam.goods_id; // 商品id
					this.goods_id = goodsId;
					console.log("goodsId"+goodsId)
					app.ajax(service['getShopDetail'],
					{
						data: {
							values: {
								goods_id: goodsId
							}
						}
					},
					function (res) {
						// var shopCode = res.data.shop_code; // 商店id
						if(res.code){
							api.toast({
							    msg: res.message,
							    duration: 2000,
							    location: 'middle'
							});

						}else{
							that.goodsList = res.data;
							that.titleContent = that.goodsList.name;
							that.textNum = that.titleContent.length;
							that.on_sale = that.goodsList.on_sale;
							that.dispatch_type = that.goodsList.dispatch_type;
							that.dispatch_fee = that.goodsList.dispatch_fee;
							that.dispatch_id = that.goodsList.dispatch_id;
							that.weight = that.goodsList.weight;
							that.genuine = that.goodsList.genuine;
							that.speed_return = that.goodsList.speed_return;
							that.seven_reason = that.goodsList.seven_reason;
							that.yzcTag = that.goodsList.is_yzc;
							that.sys_cat_name = that.goodsList.cat_name;
							that.cat_id = that.goodsList.cat_id;
							that.firstBrokerage = that.goodsList.commission1_rate;
							that.secondBrokerage = that.goodsList.commission2_rate;

							//--有商品图片
							if(that.goodsList.goods_images.length>0){
								for(var i = 0;i<that.goodsList.goods_images.length;i++){
									that.swiperImageArr[i] = that.goodsList.goods_images[i].url;
								}
								console.log(JSON.stringify(that.swiperImageArr));
								//--前端为轮播图增加class
								that.bigger = true;
								that.small = true;
								that.num = that.goodsList.goods_images.length;

								// var image_arr = that.swiperImageArr;
								// var str1 = image_arr.join("|");
								// that.imgarr = str1;
								// console.log("往接口传的图片字符串到底是什么："+that.imgarr+" typeof: "+ typeof that.imgarr +"222\n");
								that.$nextTick(function(){
									that.mySwiper.destroy(false);
									that.startSwiper();
								})
							}
							//--标签
							var tag = that.goodsList.tag;
							that.tag = tag;

							if(tag == 1){
								$('.time').css('display', 'block');
							}
							if(tag == 1){
								that.tag_name = '限时秒杀';
								that.kill_start_time = that.goodsList.date_start;
								that.kill_end_time = that.goodsList.date_end;
								$("#startTime").html(that.goodsList.date_start);
								$("#endTime").html(that.goodsList.date_end);
							}else if(tag == 2){
								that.tag_name = '品牌清仓';
							}else if(tag == 3){
								that.tag_name = '名品折扣';
							}else if(tag == 4){
								that.tag_name = '九块九特惠';
							}
							if(tag){
								$('.tag_radio').eq(tag-1).prop('checked', true);
							}
							//--商品信息
							if(that.goodsList.goods_options.length>0){
								var sku = that.goodsList.goods_options;
								for(var i = 0;i<sku.length;i++){
									if(i != 0){
										that.templateList.push(1);
									}
									that.goodsSpec[i] = sku[i].name;
									that.killPrice[i] = sku[i].kill_price;
									that.goodsPrice[i] = sku[i].sale_price;
									that.marketPrice[i] = sku[i].market_price;
									that.yzcPrice[i] = sku[i].yzc;
									that.goodsNum[i] = sku[i].stock;
									that.goodsCode[i] = sku[i].goods_sn;
									that.groupPrice[i] = sku[i].group_price;
									that.groupNum[i] = sku[i].group_num;
									that.imgSpec[i] = sku[i].option_image;
									that.reason_tag[i] =  that.groupNum[i]+"人";
								}
							}

							console.log('在循环后：'+that.tag);
							//--在mounted周期函数中获取不了that.tag
							that.$nextTick(function(){
								if(that.tag == 1){
									$('.kill_price_class').css('display', 'flex')
								}else{
									$('.kill_price_class').css('display', 'none')	//在template里的html必须在dom加载完后才能控制。
								}
							})

							//--分类
							if(that.goodsList.goods_categorys.length>0){
								var cat = that.goodsList.goods_categorys;
								that.category_id = cat[0].category_id;
								that.cat_name = cat[0].name;
							}
							//--运费模版
							if( JSON.stringify(that.goodsList.template) != '{}' ){
								var template = that.goodsList.template;
								that.dispatch_name = template.name;
							}

							//--热门还是拼团
							if(that.goodsList.hot == 1){
								that.isRecommend = true;
							}
							if(that.goodsList.group_booking == 1){
								that.isGroup = true;
							}
							//--商品详情
							var detail_arr = that.goodsList.description.split('><').join('>|||<').split('|||')
							that.detailData = detail_arr;
						}
					});

				}else{
					$('.kill_price_class').css('display', 'none')
				}





				//--添加商品详情事件监听
				api.addEventListener({
				    name: 'shopAdd'
				}, function(ret, err){
					if(ret){
						that.description = ret.value.goodsDescription;
						that.detailData = ret.value.detailData;
					}else{
						alert( JSON.stringify( err ) );
					}

				});

				//--添加商品型号图片事件监听
				api.addEventListener({
				    name: 'shopImgAdd'
				}, function(ret, err){
					if(ret){
						Vue.set(that.imgSpec, ret.value.inds, ret.value.imgChosen);	//商品型号对应的图片
					}else{
						alert( JSON.stringify( err ) );
					}
				});

				//--添加系统类目事件监听
				api.addEventListener({
				    name: 'shopAddSysCat'
				}, function(ret, err){
					if(ret){
						that.sys_cat_name = ret.value.sys_cat_name;	//系统分类名称
						that.cat_id = ret.value.sys_cat_id;	//系统类目ID
					}else{
						alert( JSON.stringify( err ) );
					}
				});

				//--添加图片事件监听
				api.addEventListener({
				    name: 'shopAddImgManage'
				}, function(ret, err){
					if(ret){
						that.swiperImageArr = ret.value.imgList;	//轮播图图片

						that.num = ret.value.num;	//已上传图片数量
						if(that.num > 0){
							that.bigger = true;
							that.small = true;
						}else{
							that.bigger = false;
							that.small = false;
						}
						that.$nextTick(function(){
							that.mySwiper.destroy(false);
							that.startSwiper();
						})

					}else{
						alert( JSON.stringify( err ) );
					}
				});

				//--键盘监听（解决ios键盘弹出后顶部样式混乱的问题）
				api.addEventListener({
				    name:'keyboardshow'
				},function(ret, err){
				    $('.header').css({'top':0,'position':'static'});
				});
				api.addEventListener({
				    name:'keyboardhide'
				},function(ret, err){
					  $('.header').css({'top':0,'position':'fixed'});
				});


			},
	  	mounted:function() {
				var that = this;
				this.startSwiper();

				//--限制商品标题输入（30个字符）
				$(".shop_add_text").keyup(function(){
            that.textNum = that.titleContent.length;
						// console.log(that.textNum)
            if(that.textNum>=30){
                that.textNum = 30;
                that.titleContent = that.titleContent.substring(0,30)
                return false;
            }
        });
				//--保证在输入中文时也会实时更新textNum
				var eventName = (navigator.userAgent.indexOf("MSIE")!=-1) ? "propertychange" :"input";
				$(".shop_add_text").bind(eventName,function(){
					that.textNum = that.titleContent.length;
				});

				//--解决ios输入法挡住输入框的问题
				$(document).on("focus","#aui-input",function(){
					setTimeout(function(){
						console.log(document.body.offsetHeight);
						window.scrollTo(0,document.body.offsetHeight-280);
					},50);
				});
	  	},

	  	methods:{
	  			//--分佣
	  			BrokeragePop: function(et){
	  				var el = et.currentTarget, self = this;
	  				if(this.firstBrokerage == '' && this.secondBrokerage == '' && this.brokerageMark){
		  				dialog.alert({
	                        title:"佣金说明",
	                        msg:"<ul class='dialog-title'><li><img src='../../../image/shop/li_style1.png'>一级分佣</li></ul>商家对商品分享者给予该商品成交价格百分比的分佣<ul class='dialog-title'><li><img src='../../../image/shop/li_style1.png'>二级分佣</li></ul>商家对商品分享者上级给予该商品成交价格百分比的分佣。",
	                        buttons:['<span class="dialog_btn">我知道了</span>']
	                    },function(){
	                    	el.focus();
	                    	self.brokerageMark = false;
	                    });
	  				}else{
	  					return;
	  				}
	  			},
				//--点击返回按钮事件
				close: function () {
					api.closeWin({
					    name: 'shopAdd'
					});
				},
				//--初始化轮播图
				startSwiper: function(){
					var that  = this;
					var mySwiper = new Swiper('.swiper-container', {
						pagination: {
							el: '.swiper-pagination',
	        		type: 'fraction'
					 	},
						observer: true,
						observeParents:true,
					})
					this.mySwiper = mySwiper;
				},
				// //--获取标签列表
				// getTag: function(){
				// 	var that = this;
				//
				// 	app.ajax(service['getTag'],
				// 	{
				// 		data: {
				// 			values: {
				//
				// 			}
				// 		}
				// 	},
				// 	function (res) {
				// 		// var shopCode = res.data.shop_code; // 商店id
				// 		if(res.code){
				// 			api.toast({
				// 			    msg: res.message,
				// 			    duration: 2000,
				// 			    location: 'middle'
				// 			});
				// 		}else{
				// 			that.tagList = res.data;
				// 			console.log(JSON.stringify(res.data));
				// 		}
				// 	});
				//
				// },
				//--打开标签说明页面
				openTag: function(){
					app.openWin('shopAddTags');
				},
				//--打开系统类目列表
				openSysCategory: function(){
					app.openWin('shop_add_sys_cat');
				},
				//--获取分类列表
				getCat: function(){
					var shopId = api.pageParam.shopId; // 商店id
					var unionid = $api.getStorage("shop_unionid"); // 用户id
					var that = this;

					app.ajax(service['getCategory'],
					{
						data: {
							values: {
								unionid: unionid,
								shop_code: shopId
							}
						}
					},
					function (res) {
						// var shopCode = res.data.shop_code; // 商店id
						if(res.code){
							api.toast({
							    msg: res.message,
							    duration: 2000,
							    location: 'middle'
							});
						}else{
							that.classfiyList = res.data;
							console.log(res);
						}
					});

				},
				//--弹出拼团人数选择框
				groupNumSelect: function(groupNumIndex){
					$('.order_refuse_cause').css('display', 'block');
					this.groupNumIndex = groupNumIndex;
				},
				//-关闭拼团人数选择框（点击模态框）
				close_order_refuse_cause: function(){
					$('.order_refuse_cause').css('display', 'none');
				},
				//--确认拼团人数
				selectGroupNumConfirm: function(){
					if(this.picked != ''){
						this.groupNum[this.groupNumIndex] = this.picked;
						Vue.set(this.reason_tag, this.groupNumIndex, this.picked+"人");
					}
					$('.order_refuse_cause').css('display', 'none');
				},
				openImgSelect: function(inds){
					if(this.swiperImageArr.length<1){
						api.toast({
						    msg: '请先添加商品图片',
						    duration: 2000,
						    location: 'middle'
						});
						return
					}
					app.openWin('imgSelect', {imgArr: this.swiperImageArr, inds: inds}, {reload: true});
				},
				// //--选择热门推荐按钮事件
				// isRec: function(){
				// 	console.log(this.isRecommend);
				// 	console.log(this.isGroup);
				// 	if(this.isRecommend){
				// 		if(this.isGroup){
				// 			this.picked = '';	//把拼团人数置零
				// 			this.groupNum = [];	//把拼团人数数组置空
				// 			this.reason_tag = [];	//把拼团人数标签数组置空
				// 			this.isGroup = false;
				// 		}
				// 	}else{
				// 		if(this.isGroup){
				// 			this.picked = '';	//把拼团人数置零
				// 			this.groupNum = [];	//把拼团人数数组置空
				// 			this.reason_tag = [];	//把拼团人数标签数组置空
				// 			this.isGroup = false;
				// 		}
				// 	}
				// },
				// //--选择极速拼团按钮事件
				// isGro: function(){
				// 	console.log(this.isRecommend);
				// 	console.log(this.isGroup);
				// 	if(this.isGroup){
				// 		if(this.isRecommend){
				// 			this.isRecommend = false;
				// 		}else{
				// 			this.picked = '';	//把拼团人数置零
				// 			this.groupNum = [];	//把拼团人数数组置零
				// 			this.reason_tag = ['请选择'];	//把拼团人数标签数组初始化
				// 		}
				// 	}else{
				// 		if(this.isRecommend){
				// 			this.isRecommend = false;
				// 		}else{
				// 			this.picked = '';	//把拼团人数置零
				// 			this.groupNum = [];	//把拼团人数数组置零
				// 			this.reason_tag = ['请选择'];	//把拼团人数标签数组初始化
				// 		}
				// 	}
				// },
				//--保存或者编辑商品信息，上传到接口
				saveOrEditGoods: function () {
					// var isGroup = this.imgSpec;
					// console.log(JSON.stringify(isGroup));
					// return;

					var shopId = api.pageParam.shopId; // 商店id
					var unionid = $api.getStorage("shop_unionid"); // 用户id

					var str1 = this.swiperImageArr.join("|");
					this.imgarr = str1;
					// console.log(this.imgarr)
					// return

					var images = this.imgarr;	//商品图片
					var goodsName = $api.trim(this.$refs.goodsName.value);	//商品标题
					var tag = this.tag;	//标签ID
					var yzcTag = this.yzcTag;	//标签ID
					var kill_start_time = this.kill_start_time;
					var kill_end_time = this.kill_end_time;

					var killPrice = this.killPrice;	//商品秒杀价格
					var goodsPrice = this.goodsPrice;	//商品价格
					var marketPrice = this.marketPrice;	//商品市场价格
					var yzcPrice = this.yzcPrice;	//商品YZC价格
					var goodsSpec = this.goodsSpec;	//商品型号
					var goodsNum = this.goodsNum;	//商品库存
					var goodsCode = this.goodsCode;	//商品编码
					var imgSpec = this.imgSpec;	//商品型号的图片
					var description = $api.trim(this.description);	//商品详情
					var cat_id = this.cat_id;	//系统分类ID
					var category_id = this.category_id;	//分类ID
					var on_sale = this.on_sale;
					var goods_id = this.goods_id;
					var skus = '';
					var dispatch_type = this.dispatch_type;
					var dispatch_fee = this.dispatch_fee;
					var dispatch_id = this.dispatch_id;
					var weight = this.weight;
					var genuine = this.genuine ? 1 : 0;
					var speed_return = this.speed_return ? 1 : 0;
					var seven_reason = this.seven_reason ? 1 : 0;
					var commission1_rate = this.firstBrokerage;
					var commission2_rate = this.secondBrokerage;
					var yzcTag = this.yzcTag ? 1 : 0;

					if(dispatch_type == 1){
						if(!dispatch_fee || dispatch_fee<=0 || dispatch_fee==''){
							api.toast({
									msg: '请正确输入固定运费...',
									duration: 2000,
									location: 'middle'
							});
							return
						}
						if(app.hasSpecialChar(dispatch_fee, '请正确输入固定运费...', 'floatNumber')){
								return;
						}
						dispatch_id = '';
						weight = '';
					}else if(dispatch_type ==2){
						if(!dispatch_id || dispatch_id==''){
							api.toast({
									msg: '请选择运费模版...',
									duration: 2000,
									location: 'middle'
							});
							return
						}
						if(!weight || weight==''){
							api.toast({
									msg: '请选择商品重量...',
									duration: 2000,
									location: 'middle'
							});
							return
						}
						if(app.hasSpecialChar(weight, '请正确输入商品重量...', 'floatNumber')){
								return;
						}
						dispatch_fee = '';
					}else{
						dispatch_fee = '';
						dispatch_id = '';
						weight = '';
					}

					if(tag == 1){
						if(kill_start_time == '' || kill_end_time == ''){
							api.toast({
									msg: '请选择秒杀时间...',
									duration: 2000,
									location: 'middle'
							});
							return
						}
					}
					if(commission1_rate != ''){
						if(app.hasSpecialChar(commission1_rate, '请输入正确的一级佣金数额', 'floatNumber')){
							return
						}else if(app.hasSpecialChar(commission1_rate, '佣金数额仅允许为整数', 'ZeroInInteger')){
							return
						}else if(commission1_rate > 100){
							api.toast({
							    msg: '请输入正确的一级佣金数额',
							    duration: 2000,
							    location: 'middle'
							});
							return
						}
					}
					if(commission2_rate != ''){
						if(app.hasSpecialChar(commission2_rate, '请输入正确的二级佣金数额', 'floatNumber')){
							return
						}else if(app.hasSpecialChar(commission2_rate, '佣金数额仅允许为整数', 'ZeroInInteger')){
							return
						}else if(commission2_rate > 100){
							api.toast({
							    msg: '请输入正确的二级佣金数额',
							    duration: 2000,
							    location: 'middle'
							});
							return
						}
					}
					if (goodsSpec.length<1 || goodsPrice.length<1 || goodsNum.length<1 || imgSpec.length<1) {
						api.toast({
								msg: '请完整填写相应的商品信息...',
								duration: 2000,
								location: 'middle'
						});
						return;
					}

					// console.log(JSON.stringify(this.goodsPrice));
					// console.log(JSON.stringify(this.marketPrice));
					// console.log(JSON.stringify(this.goodsSpec));
					// console.log(JSON.stringify(this.goodsNum));
					// console.log(JSON.stringify(this.groupPrice));
					// console.log(JSON.stringify(this.groupNum));
					//
					// return

					if(this.isGroup){
						if(this.isRecommend){
							var hot = 1;
						}else{
							var hot = 0;
						}
						var group_booking = 1;
						var groupNum = this.groupNum;	//拼团人数
						var groupPrice = this.groupPrice;	//拼团价格

						for(var i=0;i<this.templateList.length;i++){

							if (goodsSpec[i] == '' || goodsSpec[i] == null) {
								api.toast({
										msg: '请填写商品型号...',
										duration: 2000,
										location: 'middle'
								});
								return;
							}
							if (goodsPrice[i] == '' || goodsPrice[i] == null) {
								api.toast({
										msg: '请填写商品价格...',
										duration: 2000,
										location: 'middle'
								});
								return;
							} else {
								var num = parseInt(goodsPrice[i]);
								if (num == NaN) {
									api.toast({
											msg: '价格请填写数字...',
											duration: 2000,
											location: 'middle'
									});
									return;
								}else if(num<0){
									api.toast({
											msg: '商品价格超过限制...',
											duration: 2000,
											location: 'middle'
									});
									return;
								}
							}
							if(tag == 1 && killPrice[i] == ''){
								api.toast({
										msg: '限时秒杀需要填写秒杀价格...',
										duration: 2000,
										location: 'middle'
								});
								return
							} else if(killPrice[i] != ''){
								var num = parseInt(killPrice[i]);
								if (num == NaN) {
									api.toast({
											msg: '秒杀价格请填写数字...',
											duration: 2000,
											location: 'middle'
									});
									return;
								}else if(num<0){
									api.toast({
											msg: '秒杀价格超过限制...',
											duration: 2000,
											location: 'middle'
									});
									return;
								}
							}
							if(yzcTag == 1 && (yzcPrice[i] == '' || yzcPrice[i] == undefined)){
								api.toast({
										msg: '请输入商品的YZC的兑换数量...',
										duration: 2000,
										location: 'middle'
								});
								return
							} else if(yzcPrice[i] != ''){
								var num = parseInt(yzcPrice[i]);
								if (num == NaN) {
									api.toast({
											msg: 'YZC的兑换数量请填写数字...',
											duration: 2000,
											location: 'middle'
									});
									return;
								}else if(num<0){
									api.toast({
											msg: 'YZC的兑换数量超过限制...',
											duration: 2000,
											location: 'middle'
									});
									return;
								}
							}
							if (goodsNum[i] == '' || goodsNum[i] == null) {
								api.toast({
										msg: '请填写商品库存...',
										duration: 2000,
										location: 'middle'
								});
								return;
							} else {
								if(app.hasSpecialChar(goodsNum[i], '商品库存只能为整数...', 'greaterZeroInteger')){
									return
								}
							}
							if (groupPrice[i] == '' || groupPrice[i] == null) {
								api.toast({
										msg: '请填写拼团价格...',
										duration: 2000,
										location: 'middle'
								});
								return;
							} else {
								var num =parseInt(groupPrice[i]);
								if (num == NaN) {
									api.toast({
									    msg: '拼团价格请填写数字...',
									    duration: 2000,
									    location: 'middle'
									});
									return;
								}else if(num<0){
									api.toast({
									    msg: '拼团价格超过限制...',
									    duration: 2000,
									    location: 'middle'
									});
									return;
								}
							}
							if (groupNum[i] == '' || groupNum[i] == null) {
								api.toast({
								    msg: '请填写拼团人数...',
								    duration: 2000,
								    location: 'middle'
								});
								return;
							}else if(parseInt(groupNum[i]) > parseInt(goodsNum[i])){
								api.toast({
								    msg: '库存不能小于拼团人数...',
								    duration: 2000,
								    location: 'middle'
								});
								return
							}
							if (imgSpec[i] == '' || imgSpec[i] == null) {
								api.toast({
								    msg: '请选择与商品型号对应的图片...',
								    duration: 2000,
								    location: 'middle'
								});
								return;
							}

							if(killPrice[i] == undefined){
								killPrice[i] = "";
							}
							if(yzcPrice[i] == undefined){
								yzcPrice[i] = "";
							}

							if(goodsCode.length>0 && goodsCode[i] != ''){
								if(goodsCode[i] == undefined){
									 goodsCode[i] = '';
								}
								skus += goodsSpec[i]+','+killPrice[i]+','+goodsPrice[i]+'," ",'+yzcPrice[i]+','+groupPrice[i]+','+groupNum[i]+','+goodsNum[i]+','+goodsCode[i]+','+imgSpec[i]+'|';
							}else{
								skus += goodsSpec[i]+','+killPrice[i]+','+goodsPrice[i]+',"",'+yzcPrice[i]+','+groupPrice[i]+','+groupNum[i]+','+goodsNum[i]+',"",'+imgSpec[i]+'|';
							}
						}
					}else if(this.isRecommend){
						var hot = 1;
						var groupNum = [];	//拼团人数
						var groupPrice = [];	//拼团价格

						for(var i=0;i<this.templateList.length;i++){

							if (goodsSpec[i] == '' || goodsSpec[i] == null) {
								api.toast({
								    msg: '请填写商品型号...',
								    duration: 2000,
								    location: 'middle'
								});
								return;
							}
							if (goodsPrice[i] == '' || goodsPrice[i] == null) {
								api.toast({
								    msg: '请填写商品价格...',
								    duration: 2000,
								    location: 'middle'
								});
								return;
							} else {
								var num =parseInt(goodsPrice[i]);
								if (num == NaN) {
									api.toast({
									    msg: '价格请填写数字...',
									    duration: 2000,
									    location: 'middle'
									});
									return;
								}else if(num<0){
									api.toast({
									    msg: '商品价格超过限制...',
									    duration: 2000,
									    location: 'middle'
									});
									return;
								}
							}
							if(tag == 1 && killPrice[i] == ''){
								api.toast({
										msg: '限时秒杀需要填写秒杀价格...',
										duration: 2000,
										location: 'middle'
								});
								return
							} else if(killPrice[i] != ''){
								var num = parseInt(killPrice[i]);
								if (num == NaN) {
									api.toast({
											msg: '秒杀价格请填写数字...',
											duration: 2000,
											location: 'middle'
									});
									return;
								}else if(num<0){
									api.toast({
											msg: '秒杀价格超过限制...',
											duration: 2000,
											location: 'middle'
									});
									return;
								}
							}
							if(yzcTag == 1 && (yzcPrice[i] == '' || yzcPrice[i] == undefined)){
								api.toast({
										msg: '请填写商品的YZC的兑换数量...',
										duration: 2000,
										location: 'middle'
								});
								return
							} else if(yzcPrice[i] != ''){
								var num = parseInt(yzcPrice[i]);
								if (num == NaN) {
									api.toast({
											msg: 'YZC的兑换数量请填写数字...',
											duration: 2000,
											location: 'middle'
									});
									return;
								}else if(num<0){
									api.toast({
											msg: 'YZC的兑换数量超过限制...',
											duration: 2000,
											location: 'middle'
									});
									return;
								}
							}
							if (goodsNum[i] == '' || goodsNum[i] == null) {
								api.toast({
										msg: '请填写商品库存...',
										duration: 2000,
										location: 'middle'
								});
								return;
							} else {
								if(app.hasSpecialChar(goodsNum[i], '商品库存只能为整数...', 'greaterZeroInteger')){
									return
								}
								var num =parseInt(goodsNum[i]);
								if(num<0){
									api.toast({
											msg: '商品库存超过限制...',
											duration: 2000,
											location: 'middle'
									});
									return;
								}
							}
							if (imgSpec[i] == '' || imgSpec[i] == null) {
								api.toast({
										msg: '请选择与商品型号对应的图片...',
										duration: 2000,
										location: 'middle'
								});
								return;
							}

							if(killPrice[i] == undefined){
								killPrice[i] = "";
							}
							if(yzcPrice[i] == undefined){
								yzcPrice[i] = "";
							}
							if(groupPrice[i] == undefined){
								groupPrice[i] = "";
							}
							if(groupNum[i] == undefined){
								groupNum[i] = "";
							}

							if(goodsCode.length>0 && goodsCode != ''){
								if(goodsCode[i] == undefined){
									 goodsCode[i] = '';
								}
								skus += goodsSpec[i]+','+killPrice[i]+','+goodsPrice[i]+',"",'+yzcPrice[i]+','+groupPrice[i]+','+groupNum[i]+','+goodsNum[i]+','+goodsCode[i]+','+imgSpec[i]+'|';
							}else{
								skus += goodsSpec[i]+','+killPrice[i]+','+goodsPrice[i]+',"",'+yzcPrice[i]+','+groupPrice[i]+','+groupNum[i]+','+goodsNum[i]+',"",'+imgSpec[i]+'|';
							}
						}
					}else{
						var group_booking = 0;
						var hot = 0;
						var groupNum = [];	//拼团人数
						var groupPrice = [];	//拼团价格

						for(var i=0;i<this.templateList.length;i++){

							if (goodsSpec[i] == '' || goodsSpec[i] == null) {
								api.toast({
										msg: '请填写商品型号...',
										duration: 2000,
										location: 'middle'
								});
								return;
							}
							if (goodsPrice[i] == '' || goodsPrice[i] == null) {
								api.toast({
										msg: '请填写商品价格...',
										duration: 2000,
										location: 'middle'
								});
								return;
							} else {
								var num =parseInt(goodsPrice[i]);
								if (num == NaN) {
									api.toast({
											msg: '价格请填写数字...',
											duration: 2000,
											location: 'middle'
									});
									return;
								}else if(num<0){
									api.toast({
											msg: '商品价格超过限制...',
											duration: 2000,
											location: 'middle'
									});
									return;
								}
							}
							if(tag == 1 && killPrice[i] == ''){
								api.toast({
										msg: '限时秒杀需要填写秒杀价格...',
										duration: 2000,
										location: 'middle'
								});
								return
							} else if(killPrice[i] != ''){
								var num = parseInt(killPrice[i]);
								if (num == NaN) {
									api.toast({
											msg: '秒杀价格请填写数字...',
											duration: 2000,
											location: 'middle'
									});
									return;
								}else if(num<0){
									api.toast({
											msg: '商品原价超过限制...',
											duration: 2000,
											location: 'middle'
									});
									return;
								}
							}

							if(yzcTag == 1 && (yzcPrice[i] == '' || yzcPrice[i] == undefined)){
								api.toast({
										msg: '请填写商品的YZC的兑换数量...',
										duration: 2000,
										location: 'middle'
								});
								return
							} else if(yzcPrice[i] != ''){
								var num = parseInt(yzcPrice[i]);
								if (num == NaN) {
									api.toast({
											msg: 'YZC的兑换数量请填写数字...',
											duration: 2000,
											location: 'middle'
									});
									return;
								}else if(num<0){
									api.toast({
											msg: 'YZC的兑换数量超过限制...',
											duration: 2000,
											location: 'middle'
									});
									return;
								}
							}
							if (goodsNum[i] == '' || goodsNum[i] == null) {
								api.toast({
										msg: '请填写商品库存...',
										duration: 2000,
										location: 'middle'
								});
								return;
							} else {
								if(app.hasSpecialChar(goodsNum[i], '商品库存只能为整数...', 'greaterZeroInteger')){
									return
								}
								var num =parseInt(goodsNum[i]);
								if(num<0){
									api.toast({
											msg: '商品库存超过限制...',
											duration: 2000,
											location: 'middle'
									});
									return;
								}
							}
							if (imgSpec[i] == '' || imgSpec[i] == null) {
								api.toast({
										msg: '请选择与商品型号对应的图片...',
										duration: 2000,
										location: 'middle'
								});
								return;
							}

							if(killPrice[i] == undefined){
								killPrice[i] = "";
							}
							if(yzcPrice[i] == undefined){
								yzcPrice[i] = "";
							}
							if(groupPrice[i] == undefined){
								groupPrice[i] = "";
							}
							if(groupNum[i] == undefined){
								groupNum[i] = "";
							}

							if(goodsCode.length>0 && goodsCode != ''){
								if(goodsCode[i] == undefined){
									 goodsCode[i] = '';
								}
								skus += goodsSpec[i]+','+killPrice[i]+','+goodsPrice[i]+',"",'+yzcPrice[i]+','+groupPrice[i]+','+groupNum[i]+','+goodsNum[i]+','+goodsCode[i]+','+imgSpec[i]+'|';
							}else{
								skus += goodsSpec[i]+','+killPrice[i]+','+goodsPrice[i]+',"",'+yzcPrice[i]+','+groupPrice[i]+','+groupNum[i]+','+goodsNum[i]+',"",'+imgSpec[i]+'|';
							}
						}
					}

					skus = skus.substring(0,skus.length-1);	//拼接skus字符串

					if (goodsName == '' || goodsName == null) {
						api.toast({
								msg: '请填写商品标题...',
								duration: 2000,
								location: 'middle'
						});
						return;
					}else if(goodsName.length>100){
						api.toast({
								msg: '商品标题超过上限...',
								duration: 2000,
								location: 'middle'
						});
						return;
					}
					if (images == '' || images == null) {
						api.toast({
								msg: '请添加商品图片...',
								duration: 2000,
								location: 'middle'
						});
						return;
					}

					if(this.edit!=1){
						app.ajax(service['goodsAdd'],
						{
							data: {
								values: {
									shop_code: shopId,
									unionid: unionid,
									images: images,
									name: goodsName,
									tag: tag,
									kill_start_time: kill_start_time,
									kill_end_time: kill_end_time,
									cat_id: cat_id,
									category_id: category_id,
									skus: skus,
									description: description,
									group_booking: group_booking,
									hot: hot,
									on_sale: on_sale,
									commission1_rate: commission1_rate,
									commission2_rate: commission2_rate,
									dispatch_type: dispatch_type,
									dispatch_fee: dispatch_fee,
									dispatch_id: dispatch_id,
									weight: weight,
									genuine: genuine,
									speed_return: speed_return,
									seven_reason: seven_reason,
									yzc_type: yzcTag,
								}
							}
						},
						function (res) {
							// var shopCode = res.data.shop_code; // 商店id
							if(res.code){
								api.toast({
								    msg: res.message,
								    duration: 2000,
								    location: 'middle'
								});
							}else{
								api.sendEvent({
				            name: 'finishGoodsAdd'
				        });
								api.sendEvent({
				            name: 'backToGoodsManage'
				        });
								if(yzcTag || tag || cat_id){
									if(yzcTag){
										alert("添加商品成功!\n商品需要审核，请耐心等待...\n提示：YZC商品不参与分佣");
									}else{
										alert("添加商品成功!\n商品需要审核，请耐心等待...");
									}
								}else{
									alert("添加商品成功!");
								}
								app.openWin('goodsManage',{shopId: api.pageParam.shopId});

							}
						});
					}else{
						app.ajax(service['goodsEdit'],
						{
							data: {
								values: {
									shop_code: shopId,
									unionid: unionid,
									goods_id: goods_id,
									images: images,
									name: goodsName,
									tag: tag,
									kill_start_time: kill_start_time,
									kill_end_time: kill_end_time,
									cat_id: cat_id,
									category_id: category_id,
									skus: skus,
									description: description,
									group_booking: group_booking,
									hot: hot,
									on_sale: on_sale,
									commission1_rate: commission1_rate,
									commission2_rate: commission2_rate,
									dispatch_type: dispatch_type,
									dispatch_fee: dispatch_fee,
									dispatch_id: dispatch_id,
									weight: weight,
									genuine: genuine,
									speed_return: speed_return,
									seven_reason: seven_reason,
									yzc_type: yzcTag,
								}
							}
						},
						function (res) {
							// var shopCode = res.data.shop_code; // 商店id
							if(res.code){
								api.toast({
										msg: res.message,
										duration: 2000,
										location: 'middle'
								});
							}else{
								if(yzcTag){
									alert("编辑商品成功!\n发布YZC商品需要审核，请耐心等待...");
								}else{
									alert("编辑商品成功!");
								}
								//--发送事件（使商品管理页面刷新）
								api.sendEvent({
										name: 'backToGoodsManage',
								});
							}
						});
					}
				},
				//--打开上传图片页面
				openImgManage: function(){
					app.openWin('shopAddImgManage',{imgArr: this.swiperImageArr})
				},
				//--批量上传图片
				getPictureS:function(){
					var that = this;
					app.getPictureS(8,this.num,service['fileupload'],function(res){
						if(res.length > 0){
							api.toast({
									msg: '上传成功',
									duration: 2000,
									location: 'middle'
							});
							// console.log("我传的图片字符串到底是什么："+res+" typeof: "+ res.constructor +"1111\n");
							// var str1 = res.join("|");
							// if(that.imgarr==''){
							// 	that.imgarr = str1;
							// }else{
							// 	that.imgarr = that.imgarr + '|' + str1;
							// }
							// console.log("往接口传的图片字符串到底是什么："+that.imgarr+" typeof: "+ typeof that.imgarr +"222\n");

							//前端为轮播图增加class
							that.bigger = true;
							that.small = true;
							that.num = that.num + res.length;

							that.swiperImageArr.push(res);
							console.log("第一步："+that.swiperImageArr+" typeof: "+ that.swiperImageArr.constructor +"1111\n");
							var str4 = that.swiperImageArr.join(",");
							console.log("第一步："+str4+" typeof: "+ str4.constructor +"1111\n");
							that.swiperImageArr = str4.split(",");
							console.log("第三步："+that.swiperImageArr+" typeof: "+ that.swiperImageArr.constructor +"1111\n");
							// console.log(that.swiperImageArr[0]+" &Length:"+that.swiperImageArr.length+" &typeof: "+typeof that.swiperImageArr +"\n")
							// console.log(JSON.stringify(that.swiperImageArr) +" : "+that.swiperImageArr.constructor);
							that.$nextTick(function(){
								that.mySwiper.destroy(false);
								$(".swiper-pagination").css("display","block")
								that.startSwiper()// swiper重新初始化
							})
						}
					})
				},
				//--添加商品型号
				addGoods: function (e) {
					if(e.target.nodeName == 'DIV'){
						this.templateList.push('1');
						this.reason_tag.push('请选择');
					}

				},
				//--删除商品型号
				addModelDel: function(index){
					console.log("号码是多少："+index)
					console.log(JSON.stringify(this.templateList));
					this.templateList.splice(index, 1);
					this.goodsSpec.splice(index, 1);
					this.killPrice.splice(index, 1);
					this.goodsPrice.splice(index, 1);
					this.marketPrice.splice(index, 1);
					this.yzcPrice.splice(index, 1);
					this.goodsNum.splice(index, 1);
					this.goodsCode.splice(index, 1);
					this.groupNum.splice(index, 1);
					this.groupPrice.splice(index, 1);
					this.reason_tag.splice(index, 1);
					this.imgSpec.splice(index, 1);
				},
				//--打开商品详情页
				goodsDetail: function () {
					app.openWin('goodsDetail',{shopGoodsContent: this.detailData})
				},
				//---------------------------------------------
				//--打开标签选择页面
				showShopTag: function(){
					$('.batch_classfiy2').css("display", "block");
					$('body, html').css("z-index", "-1");
				},
				close_batch_classfiy2: function(){
					$('.batch_classfiy2').css("display", "none");
				},
				getTagId: function(tag_id){
					console.log(this.tag);

					if(this.tag == tag_id){
						this.tag = '';
						$('.batch_classfiy2').find('.aui-radio').prop('checked', false);
					}else{
						this.tag = tag_id;
					}
				},
				//--选择标签后取消事件
				tagCancel: function(){
					$('.batch_classfiy2').css("display", "none");
					if(this.tag == 1){
						$('.time').css("display", "none");
						$('.kill_price_class').css("display", "none");
						this.kill_start_time = '';
						this.kill_end_time = '';
						this.killPrice = [];
					}
					this.tag = '';
					this.tag_name = '';
					$('.batch_classfiy2').find('.aui-radio').prop('checked', false);
				},
				//--选择标签后确认事件
				tagSure: function(tag_name){
					$('.batch_classfiy2').css("display", "none");
					this.tag_name = $("input[name='tagName']:checked").siblings('span').html();
					// $('.tag_name').html(tag_name);

					if(this.tag == 1){
						$('.time').css("display", "block");
						if(this.kill_start_time == '' || this.kill_end_time == ''){
							$('#startTime').html("");
							$('#endTime').html("");
						}
						$('.kill_price_class').css("display", "flex");
					}else{
						$('.time').css("display", "none");
						$('.kill_price_class').css("display", "none");
						this.kill_start_time = '';
						this.kill_end_time = '';
						this.killPrice = [];
					}
				},
				//时间位数为1位数时，前面补0
				setFormat: function (x) {
				  if (x < 10) {
				    x = "0" + x;
				  }
				  return x;
				},
				startTime: function(){
					var that = this;
					var dtpicker = new mui.DtPicker({
					    "type": "hour",
					})
					dtpicker.show(function(rs) {

							var now = app.getCurentTime();
							if(rs.text < now){
								api.toast({
								    msg: '不能选择过去的时间...',
								    duration: 2000,
								    location: 'middle'
								});
								return
							}else{
								var startTimeString = rs.text+':00:00';
								// 获取某个时间格式的时间戳
								var timestamp2 = new Date(startTimeString.replace(/-/g,   "/")); //转换成Data();
								timestamp2.setHours (timestamp2.getHours () + 1);	//获取下一个小时的 Date() 对象
								Y = timestamp2.getFullYear() + '-';
								M = (timestamp2.getMonth()+1 < 10 ? '0'+(timestamp2.getMonth()+1) : timestamp2.getMonth()+1) + '-';
								D = that.setFormat(timestamp2.getDate()) + ' ';
								h = that.setFormat(timestamp2.getHours()) + ':';
								m = that.setFormat(timestamp2.getMinutes()) + ':';
								s = that.setFormat(timestamp2.getSeconds());
								var endTimeString = Y+M+D+h+m+s;

								// timestamp2 = timestamp2 / 1000;
								// //2014-07-10 10:21:12的时间戳为：1404958872
								// console.log(startTimeString + "的时间戳为：" + timestamp2);

								document.getElementById('startTime').innerHTML = startTimeString;
								document.getElementById('endTime').innerHTML = endTimeString;
								that.kill_start_time = startTimeString;
								that.kill_end_time = endTimeString;

								dtpicker.dispose()
							}
					})
				},
				//---------------------------------------------
				//--点击选择分类
				goodsClassfiy: function(){
					$('.batch_classfiy').css("display", "block");
					$('body, html').css("z-index", "-1");
				},
				close_batch_classfiy: function(){
					$('.batch_classfiy').css("display", "none");
					this.category_id = '';
				},
				//--点击分类选择事件
				getCategory: function(cat_id){
					console.log(this.category_id);

					if(this.category_id == cat_id){
						this.category_id = '';
						$('.batch_classfiy').find('.aui-radio').prop('checked', false);
					}else{
						this.category_id = cat_id;
					}
				},
				//--取消选择分类
				classfiyCancel: function(et){
					$('.batch_classfiy').css("display", "none");
					this.category_id = '';
					$('.batch_classfiy').find('.aui-radio').prop('checked', false);
				},
				//--确定选择分类
				classfiySure: function(){
					$('.batch_classfiy').css("display", "none");
					this.cat_name = $("input[name='classifyName']:checked").siblings('span').html();
				},
				//--新建分类
				newClassfiy: function(et){
					var that = this;
					var shopId = api.pageParam.shopId; // 商店id
					var unionid = $api.getStorage("shop_unionid"); // 用户id

					dialog.prompt({
              title: "新建分类",
              text: "输入分类名称",
              buttons: ['取消', '确定']
          }, function(ret) {
            // alert(JSON.stringify(ret));
            if(ret.buttonIndex == 2){ //  确认
							var name = $api.trim(ret.text);

							if (name == '' || name == null) {
								api.toast({
										msg: "请输入正确的分类名称...",
										duration: 2000,
										location: 'middle'
								});
								name.value = '';
								return false;
							}else if(name.length > 10){
								api.toast({
										msg: "名称字数超过上限...",
										duration: 2000,
										location: 'middle'
								});
								return false;
							}
							//--判断是否存在特殊字符
							if(app.hasSpecialChar(name, '请正确输入分类名称...', '')){
								return
							}

							app.ajax(service['addCategory'],
							{
								data: {
									values: {
										shop_code: shopId,
										unionid: unionid,
										name: name
									}
								}
							},
							function (res) {
								//返回category_id
								if(res.code){
									api.toast({
											msg: res.message,
											duration: 2000,
											location: 'middle'
									});
								}else{
									that.category_id = res.data;
									console.log(this.category_id);
									alert("新建分类成功！");

									that.getCat();
								}
							});
            }
          })

					// layer = layui.layer;
				  // var layer = layui.layer;
					//
					// layer.prompt({title: '输入任何口令，并确认', formType: 1}, function(pass, index){
					//   layer.close(index);
					//   layer.prompt({title: '随便写点啥，并确认', formType: 2}, function(text, index){
					//     layer.close(index);
					//     layer.msg('演示完毕！您的口令：'+ pass +'<br>您最后写下了：'+text);
					//   });
					// });

				},
				//---------------------------------------------
				//--获取运费模版列表
				getDispatchList: function(){
					var shopId = api.pageParam.shopId; // 商店id
					var unionid = $api.getStorage("shop_unionid"); // 用户id
					var that = this;

					app.ajax(service['getDispatch'],
					{
						data: {
							values: {
								unionid: unionid,
								shop_code: shopId
							}
						}
					},
					function (res) {
						// var shopCode = res.data.shop_code; // 商店id
						if(res.code){
							api.toast({
							    msg: res.message,
							    duration: 2000,
							    location: 'middle'
							});
						}else{
							that.dispatchList = res.data;
							console.log(res);
						}
					});

				},
				//--选择是否包邮
				getDispatchId: function(dispatch_type){

					this.dispatch_type = dispatch_type;

					// console.log(this.tag);
					//
					// if(this.tag == dispatch_type){
					// 	this.tag = '';
					// 	$('.batch_classfiy2').find('.aui-radio').prop('checked', false);
					// }else{
					// 	this.tag = dispatch_type;
					// }
				},
				//---------------------------------------
				//--点击选择运费模版
				dispatchBatch: function(){
					$('.batch_classfiy3').css("display", "block");
					$('body, html').css("z-index", "-1");
				},
				close_batch_classfiy3: function(){
					$('.batch_classfiy3').css("display", "none");
					this.dispatch_id = '';
				},
				//--点击运费模版选择事件
				getDispatch: function(dispatch_id){
					console.log(this.dispatch_id);

					if(this.dispatch_id == dispatch_id){
						this.dispatch_id = '';
						$('.batch_classfiy3').find('.aui-radio').prop('checked', false);
					}else{
						this.dispatch_id = dispatch_id;
					}
				},
				//--取消选择运费模版
				dispatchCancel: function(et){
					$('.batch_classfiy3').css("display", "none");
					this.dispatch_id = '';
					$('.batch_classfiy3').find('.aui-radio').prop('checked', false);
				},
				//--确定选择运费模版
				dispatchSure: function(){
					$('.batch_classfiy3').css("display", "none");
					this.dispatch_name = $("input[name='dispatchName']:checked").siblings('span').html();
				},
				//-----------------------------------
				//--下架商品
				offButton: function(goods_id){
					var shopId = api.pageParam.shopId; // 商店id
					var unionid = $api.getStorage("shop_unionid"); // 用户id
					var that = this;

					dialog.alert({
              title: "商品下架提示",
              msg: '请确认是否下架该商品',
              buttons: ['取消', '确定']
          }, function(ret) {
						if(ret.buttonIndex == 2){ //确认
							app.ajax(service['productOnSale'],
							{
								data: {
									values: {
										shop_code: shopId,
										unionid: unionid,
										goods_id: goods_id,
										on_sale: 0
									}
								}
							},
							function (res) {
								//返回category_id
								if(res.code){
									api.toast({
											msg: res.message,
											duration: 2000,
											location: 'middle'
									});
								}else{
									that.on_sale = 0;
									api.toast({
											msg: '商品已下架',
											duration: 2000,
											location: 'middle'
									});

									//--发送事件（使商品管理页面刷新）
									api.sendEvent({
											name: 'backToGoodsManage',
									});
								}
							});
						}
					})
				},
				//--上架商品
				onButton: function(goods_id){
					var shopId = api.pageParam.shopId; // 商店id
					var unionid = $api.getStorage("shop_unionid"); // 用户id
					var that = this;

					app.ajax(service['productOnSale'],
					{
						data: {
							values: {
								shop_code: shopId,
								unionid: unionid,
								goods_id: goods_id,
								on_sale: 1
							}
						}
					},
					function (res) {
						//返回category_id
						if(res.code){
							api.toast({
									msg: res.message,
									duration: 2000,
									location: 'middle'
							});
						}else{
							that.on_sale = 1;
							api.toast({
									msg: '商品已上架',
									duration: 2000,
									location: 'middle'
							});
							//--发送事件（使商品管理页面刷新）
							api.sendEvent({
							    name: 'backToGoodsManage',
							});
						}
					});

				},
				//--删除商品
				delButton: function(goods_id){
					var shopId = api.pageParam.shopId; // 商店id
					var unionid = $api.getStorage("shop_unionid"); // 用户id
					var that = this;

					dialog.alert({
              title: "商品回收提示",
              msg: '请确认是否删除该商品',
              buttons: ['取消', '确定']
          }, function(ret) {
						if(ret.buttonIndex == 2){ //确认
							app.ajax(service['productDel'],
							{
								data: {
									values: {
										shop_code: shopId,
										unionid: unionid,
										goods_id: goods_id
									}
								}
							},
							function (res) {
								//返回category_id
								if(res.code){
									api.toast({
											msg: res.message,
											duration: 2000,
											location: 'middle'
									});
								}else{
									api.toast({
											msg: '商品已删除',
											duration: 2000,
											location: 'middle'
									});

									//--发送事件（使商品管理页面刷新）
									api.sendEvent({
											name: 'backToGoodsManage',
									});

									api.closeWin();

								}
							});
						}
					});
				},
				//--打开发布商品规则页面
				openAddRules: function (){
					app.openWin('shopAddRules');
				},
			}
		};
			// var shopVue = new Vue(vm);
			var even = function(){


			};

			var newVue = new Vue(vm);
			even();

	})
}
